{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=2796
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	ls,x,n,i,j,kk:longint;
	s,t:string;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(x,n);
s:=inttostr(x);
for i:=2 to n do begin
	j:=1;
	t:='';
	ls:=length(S);
	s:=s+'$';
	while j<=ls do begin
		kk:=1;
		while (s[j+1]=s[j]) and (j<=ls) do begin
			inc(j);
			inc(kk);
		end;
    t:=t+inttostr(kk)+s[j];
		inc(j);
	end;
	s:=t;
end;
write(s);
end.